package com.oa.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @Author: 一拳超人
 * @Date: 2021/9/12
 */

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SysResult implements Serializable {
    private static final long serialVersionUID = 4011077886540577908L;
    /**
     * 状态码；200:成功，201:失败
     */
    private Integer status;
    /**
     * 服务器提示信息；
     */
    private String msg;
    /**
     * 封装后台返回值
     */
    private Object data;

    public static SysResult fail() {
        return new SysResult(201, "失败", null);
    }

    public static SysResult fail(Object data) {
        return new SysResult(201, "失败", data);
    }

    public static SysResult success() {
        return new SysResult(200, "成功", null);
    }

    public static SysResult success(Object data) {
        return new SysResult(200, "成功", data);
    }

    public static SysResult success(String msg, Object data) {
        return new SysResult(200, msg, data);
    }
}
